package cn.wolfcode.consumer;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author LuoRis
 * @date 2021/03/04 14:49
 * @description 消费者
 */
@Component
@RocketMQMessageListener(
        topic = "hello-springboot",
        consumerGroup = "wolfcode-consumer"
)
public class HelloConsumer implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt messageExt) {
        System.out.println("消费消息"+messageExt);
        System.out.println("消费消息:"+new String(messageExt.getBody()));
    }
}
